//---------------------------------------------------------------------------


#pragma hdrstop

#include "TSpeedTimePosition.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

__fastcall TSpeedTimePosition::TSpeedTimePosition()
{
   CutID = 0;
	Speed = 0;
	PreSpeed = 0;
   Time = 0;
   Position = 0;
};

__fastcall TVTS::TVTS()
{
	Pos = 0;
	resize(0);
};


void __fastcall TVTS::Add(const unsigned short CutID,
                          const float Speed,
                          const float Time,
								  const float Position,
								  const float PreSpeed,
								  const float PrePosition)
{
   TSpeedTimePosition VTS;
   VTS.CutID = CutID;
	VTS.Speed = Speed;
	VTS.PreSpeed = PreSpeed;
   VTS.Time = Time;
	VTS.Position = Position;
	VTS.PrePosition = PrePosition;
   push_back(VTS);
};


TSpeedTimePosition __fastcall TVTS::GetVTS(const unsigned short Index)
{
	return at(Index);
};

TSpeedTimePosition * __fastcall TVTS::GetSpeedTimePosition(const unsigned short Index)
{
	if (Index < size())
		return &at(Index);
	else
		return NULL;
};


TSpeedTimePosition & __fastcall TVTS::operator [] (const unsigned short Index)
{
   return at(Index);
}

void __fastcall TVTS::SetQuantity(unsigned NewQuantity)
{
   resize(NewQuantity);
}

bool __fastcall TVTS::MoveNext(void)
{
	if (Pos++ < size())
		return true;
	else
		return false;
}

TSpeedTimePosition * __fastcall TVTS::GetCurrent(void)
{
	return GetSpeedTimePosition(Pos);
}
